import { Field, Int, ObjectType } from '@nestjs/graphql';
import { CommonSchema, KeyValueList } from 'src/common/mongodb/commonSchema';
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { GraphQLBigInt } from 'graphql-scalars';

@ObjectType()
@Schema({ collection: 'RoleModelData' })
export class RoleModelData extends CommonSchema {
  @Field(() => Int!)
  @Prop()
  playerUid?: number;

  @Field(() => String!)
  @Prop()
  name: string;

  @Field(() => Int!)
  @Prop()
  lastLoginTime: number;

  @Field(() => Int!)
  @Prop()
  lastLoginDay: number;

  @Field(() => Int!)
  @Prop()
  loginDay: number;

  @Field(() => [KeyValueList]!)
  @Prop()
  bagItems: Map<number, bigint[]>;

  @Field(() => [GraphQLBigInt]!)
  @Prop()
  heros: bigint[];

  @Field(() => [KeyValueList]!)
  @Prop()
  heroFormations: Map<number, bigint[]>;

  @Field(() => [KeyValueList]!)
  @Prop()
  levelDataUids: Map<number, bigint>;
}

export type RoleModelDataDocument = RoleModelData & Document;
export const RoleModelDataSchema = SchemaFactory.createForClass(RoleModelData);
